package com.example.androidproject.adapter

import com.android.baselibrary.base.BaseAdapter
import com.example.androidproject.R
import com.example.androidproject.bean.DataBean
import com.example.androidproject.databinding.ItemGridBinding

class GridAdapter:BaseAdapter<DataBean,ItemGridBinding>() {
    private var mClick:((DataBean,Int)->Unit)?=null
    override fun getItemLayoutId(): Int = R.layout.item_grid
    override fun covert(binding: ItemGridBinding, t: DataBean, position: Int) {
        binding.data = t
        binding.executePendingBindings()
        binding.tvContent.setOnClickListener{
           mClick?.invoke(t,position)
        }

    }
    fun setOnClickListener(click:(DataBean,Int)->Unit){
        this.mClick = click
    }

}